package com.meal.base.test.enumtest;

/**
 * @program: meal->OrderStatusEnum
 * @description: 订单状态枚举类
 * @author: yangzhanghui
 * @create: 2020-04-19 18:32
 **/
public enum OrderStatusEnum {
    ORDER("影票卖品订单", "ORDER"),
    BUYCARD("购卡订单", "BUYCARD"),
    RECHARGECARD("卡充值订单", "RECHARGECARD"),
    GOODS("商品中心订单", "GOODS");

    private String name;
    private String value;

    // 构造方法
    private OrderStatusEnum(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getName(String value) {
        for (OrderStatusEnum orderPaymentType : OrderStatusEnum.values()) {
            if (value.equals(orderPaymentType.getValue())) {
                return orderPaymentType.getName();
            }
        }
        return null;
    }

    public static String getValue(String name) {
        for (OrderStatusEnum orderPaymentType : OrderStatusEnum.values()) {
            if (name.equals(orderPaymentType.getName())) {
                return orderPaymentType.getValue();
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return name + " " + value;
    }
}